<?php

namespace app\admin\model\dts\point;

use think\Model;


class Time extends Model
{

    

    

    // 表名
    protected $name = 'dts_point_time';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text'
    ];
    

    
    public function getTypeList()
    {
        return ['not' => __('Type not'), 'day' => __('Type day'), 'week' => __('Type week'), 'toweek' => __('Type toweek'), 'month' => __('Type month')];
    }
    
    public function getIsevenList()
    {
        return ['0' => __('Is_even 0'), '1' => __('Is_even 1')];
    }

    public function getWeekarrList()
    {
        return ['0' => __('Weekarr 0'), '1' => __('Weekarr 1'), '2' => __('Weekarr 2'), '3' => __('Weekarr 3'), '4' => __('Weekarr 4'), '5' => __('Weekarr 5'), '6' => __('Weekarr 6')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
